#include "cximuticomb_p.h"
#include "designer/cxcontrolsdesignercollection.h"
#include <QLineEdit>
#include <QVBoxLayout>

CXiMutiCombPrivate::CXiMutiCombPrivate(CXiMutiComb* p)
	: q_ptr(p)
	,popup(nullptr)
	,dropDownButton(nullptr)
	,cmbLineEdit(nullptr)
	,separator(",")
{
	init();
}
CXiMutiCombPrivate::~CXiMutiCombPrivate()
{
}
void CXiMutiCombPrivate::init()
{
	Q_Q(CXiMutiComb);
	popup = new CxiMutiCmbPop(q);
	cmbLineEdit = new QLineEdit(q);
	dropDownButton = new QPushButton(q);
	QHBoxLayout* layout = new QHBoxLayout(q);
	cmbLineEdit->setReadOnly(true);
	layout->setSpacing(0);
	layout->setContentsMargins(0, 0, 0, 0);
	layout->addWidget(cmbLineEdit);
	layout->addWidget(dropDownButton);
	q->setLayout(layout);
	popup->hide();
	QObject::connect(dropDownButton,&QPushButton::clicked,
		q_ptr,&CXiMutiComb::popup);

	QObject::connect(popup,&CxiMutiCmbPop::stateChanged,
		q_ptr,&CXiMutiComb::stateChanged);
}
